<extend name="./public/frame.html"/>
<block name="content">
    <style>
        .box1{margin: 10px;}
        .box2{ background: #fff; height: 260px; position: relative; overflow:hidden;margin-bottom: 10px; width: 100%;}
        .touxiang{ float:left;width: 260px; height: 260px; border-right:10px solid #eee;text-align:center;}
        .touxiang img{width: 97%;padding: 5px;}
        .text{margin-left: 280px; font-size: 20px;}
        .text .layui-table{margin: 0px;width: 100%}
        .text .layui-table td{border:0px;height: 34px;padding: 8px;}
        .box3{ height: auto; background:#fff; }
    </style>
    <div style="padding: 5px; background-color: #F2F2F2;">
        <div class="box1">
            <div class="box2">
                <div class="touxiang">
                    <?php if(!empty($userInfo['avatar'])):?>
                    <img src="{$userInfo['avatar']}">
                    <?php endif;?>
                </div>
                <div class="text">
                    <table class="layui-table">
                        <tr>
                            <td colspan="4" style="font-size: 20px;font-weight: bold;">基本信息</td>
                            <?php if($adminInfo[admin_type]==1){ ?>
                            <td colspan="4" style="font-size: 16px">余额：{$userWallet['wallet_money']}</td>
                            <td colspan="4" style="font-size: 16px;font-weight: bold;">
                                <input type="text" value="0" class="layui-input abc" style="width:150px;display: inline;margin-right: 15px">分<button class="layui-btn layui-btn-danger layui-btn-sm" onclick="upMoney(this,{$userInfo['uid']})">修 改</button>
                            </td>
                            <?php } ?>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: right">用户名</td>
                            <td style="width: 40%;"><?php if(!empty($userInfo['username'])):?><?php echo $userInfo['username'];?><?php else:?><span style="color: green">未填写</span><?php endif;?></td>
                            <td style="width: 10%;text-align: right">性别</td>
                            <td>
                                <?php if(!empty($userInfo['user_gender']) && $userInfo['user_gender'] == 1):?>
                                男
                                <?php elseif(!empty($userInfo['user_gender']) && $userInfo['user_gender'] == 2):?>
                                女
                                <?php else:?>
                                保密
                                <?php endif;?>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: right">手机号</td>
                            <td><?php echo $userInfo['user_phone'];?></td>
                            <td style="width: 10%;text-align: right">生日</td>
                            <td>
                                <?php if(!empty($userInfo['birthday'])):?>
                                <?php echo $userInfo['birthday'];?>
                                <?php else:?>
                                -
                                <?php endif;?>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: right">注册城市</td>
                            <td><?php echo $userInfo['city_name'];?></td>
                            <td style="width: 10%;text-align: right">注册时间</td>
                            <td>
                                <?php if(!empty($userInfo['register_time'])):?>
                                <?php echo date("Y-m-d H:i:s",$userInfo['register_time']);?>
                                <?php else:?>
                                -
                                <?php endif;?>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: right">注册IP</td>
                            <td><?php echo $userInfo['register_ip'];?></td>
                            <td style="width: 10%;text-align: right">最近登录时间</td>
                            <td>
                                <?php if(!empty($userInfo['last_login_time'])):?>
                                <?php echo date("Y-m-d H:i:s",$userInfo['last_login_time']);?>
                                <?php else:?>
                                -
                                <?php endif;?>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
            <div class="box3">
                <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief" style="display:block;width:100%;height:auto;background:white;">
                    <ul class="layui-tab-title">
                        <li class="layui-this">实名认证</li>
                        <li>银行卡信息</li>
                        <li>会员信息</li>
                        <li>充值记录</li>
                        <li>消费记录</li>
                        <li>退款记录</li>
                        <li>推广记录</li>
                        <li>佣金明细</li>
                        <li>奖励流水</li>
                    </ul>
                    <div class="layui-tab-content" >
                        <div class="layui-tab-item layui-show">
                            <table class="layui-table">
                                <?php if(!empty($userInfo['real_name_authentication'])):?>
                                <tr>
                                    <td width="10%">身份证姓名</td>
                                    <td><?php echo $userInfo['real_name'];?></td>
                                </tr>
                                <tr>
                                    <td>身份证号码</td>
                                    <td><?php echo $userInfo['id_card_number'];?></td>
                                </tr>
                                <tr>
                                    <td>实名认证时间</td>
                                    <td>
                                        <?php if(!empty($userAuthInfo['real_name_authentication_time'])):?>
                                        <?php echo date("Y-m-d H:i:s",$userAuthInfo['real_name_authentication_time']);?>
                                        <?php else:?>
                                        -
                                        <?php endif;?>
                                    </td>
                                </tr>
                                <?php else:?>
                                <tr>
                                    <td width="10%">实名认证</td>
                                    <td style="color: red">未认证</td>
                                </tr>
                                <?php endif;?>
                                <?php if(!empty($userAuthInfo['id_authentication'])):?>
                                <tr>
                                    <td>证件照片认证时间</td>
                                    <td>
                                        <?php if(!empty($userAuthInfo['id_authentication_time'])):?>
                                        <?php echo date("Y-m-d H:i:s",$userAuthInfo['id_authentication_time']);?>
                                        <?php else:?>
                                        -
                                        <?php endif;?>
                                    </td>
                                </tr>
                                <tr>
                                    <td>身份证照片</td>
                                    <td class="layer-photos-demo">
                                        <img layer-src="{$userAuthInfo['id_front']}" alt="身份证正面" src="{$userAuthInfo['id_front']}">
                                        <img layer-src="{$userAuthInfo['id_back']}" alt="身份证反面" src="{$userAuthInfo['id_back']}">
                                    </td>
                                </tr>
                                <?php else:?>
                                <tr>
                                    <td width="10%">身份认证</td>
                                    <td style="color: red">未认证</td>
                                </tr>
                                <?php endif;?>
                            </table>
                        </div>
                        <div class="layui-tab-item">
                            <table class="layui-table">
                                <?php if(!empty($userAuthInfo['bank_authentication'])):?>
                                <tr>
                                    <td width="10%">持卡人</td>
                                    <td><?php echo $bankInfo['real_name'];?></td>
                                </tr>
                                <tr>
                                    <td>银行卡号</td>
                                    <td><?php echo $bankInfo['bank_num'];?></td>
                                </tr>
                                <tr>
                                    <td>银行卡</td>
                                    <td><?php echo $bankInfo['bank_card'];?></td>
                                </tr>
                                <tr>
                                    <td>卡类型</td>
                                    <td><?php echo $bankInfo['card_type'];?></td>
                                </tr>
                                <tr>
                                    <td>开户支行</td>
                                    <td><?php echo $bankInfo['bank_addr'];?></td>
                                </tr>
                                <tr>
                                    <td>联系地址</td>
                                    <td><?php echo $bankInfo['address'];?></td>
                                </tr>
                                <?php else:?>
                                <tr>
                                    <td width="10%">银行卡信息</td>
                                    <td style="color: red">未认证</td>
                                </tr>
                                <?php endif;?>
                            </table>
                        </div>
                        <div class="layui-tab-item">
                            <table class="layui-table">
                                <?php if(!empty($memberInfo['member_status'])):?>
                                <tr>
                                    <td width="10%">会员状态</td>
                                    <td>
                                        <?php if(!empty($memberInfo['end_time']) && $memberInfo['end_time'] >= time()):?>
                                        <span style="color: green">已开通</span>
                                        <?php else:?>
                                        <span style="color: red">已过期</span>
                                        <?php endif;?>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="10%">会员等级</td>
                                    <td>V<?php echo $memberInfo['level'];?></td>
                                </tr>
                                <tr>
                                    <td width="10%">会员有效期</td>
                                    <td>
                                        <?php echo date("Y-m-d",$memberInfo['start_time']);?> / <?php echo date("Y-m-d",$memberInfo['end_time']);?>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="10%">推荐人数(钻石)</td>
                                    <td><?php echo $memberInfo['diamond_number'];?></td>
                                </tr>
                                <tr>
                                    <td width="10%">推荐人数(黄金)</td>
                                    <td><?php echo $memberInfo['cold_number'];?></td>
                                </tr>
                                <tr>
                                    <td width="10%">累计佣金(元)</td>
                                    <td><?php echo $memberInfo['sum_money'];?></td>
                                </tr>
                                <tr>
                                    <td width="10%">佣金余额(元)</td>
                                    <td><?php echo $memberInfo['wallet_money'];?></td>
                                </tr>
                                <?php else:?>
                                <tr>
                                    <td width="10%">会员状态</td>
                                    <td style="color: red">未开通</td>
                                </tr>
                                <?php endif;?>
                            </table>
                        </div>
                        <div class="layui-tab-item">
                            <table class="layui-table" lay-data="{width:'auto', height:'auto', url:'{:url('UserRechargeLog/table')}',page: true, limit: 10,where:{statement:'recharge',uid:{$userInfo['uid']}},id:'money1'}" lay-filter="money1">
                                <thead>
                                    <tr>
                                        <th lay-data="{field:'money_id', width:80, fixed: true, align:'center'}">ID</th>
                                        <th lay-data="{field:'uid', width:80, fixed: true, align:'center'}">UID</th>
                                        <th lay-data="{field:'user_phone', width:120, align:'center'}">手机号</th>
                                        <th lay-data="{field:'out_trade_no', width:220, align:'center'}">交易号</th>
                                        <th lay-data="{field:'money', width:150, align:'center'}">可提现金额</th>
                                        <th lay-data="{field:'return_money', width:150, align:'center'}">不可提现金额</th>
                                        <th lay-data="{field:'gifts_money', width:150, align:'center'}">赠送金额</th>
                                        <th lay-data="{field:'status_name', width:150, align:'center'}">状态</th>
                                        <th lay-data="{field:'type', width:150, align:'center'}">付款方式</th>
                                        <th lay-data="{field:'time', width:180, align:'center'}">充值时间</th>
                                    </tr>
                                </thead>
                            </table>
                        </div>
                        <div class="layui-tab-item">
                            <table class="layui-table" lay-data="{width:'auto', height:'auto', url:'{:url('UserRechargeLog/table')}',page: true, limit: 10,where:{statement:'flow',uid:{$userInfo['uid']}},id:'money2'}" lay-filter="money2">
                                <thead>
                                <tr>
                                    <th lay-data="{field:'money_id', width:80, fixed: true, align:'center'}">ID</th>
                                    <th lay-data="{field:'uid', width:80, fixed: true, align:'center'}">UID</th>
                                    <th lay-data="{field:'user_phone', width:120, align:'center'}">手机号</th>
                                    <th lay-data="{field:'out_trade_no', width:220, align:'center'}">消费订单号</th>
                                    <th lay-data="{field:'statement_type', width:150, align:'center'}">消费类型</th>
                                    <th lay-data="{field:'money', width:150, align:'center'}">消费金额</th>
                                    <th lay-data="{field:'type', width:150, align:'center'}">付款方式</th>
                                    <th lay-data="{field:'time', width:180, align:'center'}">消费时间</th>
                                </tr>
                                </thead>
                            </table>
                        </div>
                        <div class="layui-tab-item">
                            <table class="layui-table" lay-data="{width:'auto', height:'auto', url:'{:url('UserRechargeLog/table')}',page: true, limit: 10,where:{statement:'refund',uid:{$userInfo['uid']}},id:'money3'}" lay-filter="money3">
                                <thead>
                                <tr>
                                    <th lay-data="{field:'money_id', width:80, fixed: true, align:'center'}">ID</th>
                                    <th lay-data="{field:'uid', width:80, fixed: true, align:'center'}">UID</th>
                                    <th lay-data="{field:'user_phone', width:120, align:'center'}">手机号</th>
                                    <th lay-data="{field:'out_trade_no', width:220, align:'center'}">退款流水号</th>
                                    <th lay-data="{field:'statement_type', width:150, align:'center'}">退款类型</th>
                                    <th lay-data="{field:'money', width:150, align:'center'}">退款金额</th>
                                    <th lay-data="{field:'time', width:180, align:'center'}">退款时间</th>
                                </tr>
                                </thead>
                            </table>
                        </div>
                        <div class="layui-tab-item">
                            <div class="layer_content">
                                <div class="layer_form">
                                    <div class="down_icon"></div>
                                    <div class="layer_div">
                                        <div class="layer_tit">
                                            手机号：
                                        </div>
                                        <div class="layer_control">
                                            <input type="text" class="w180" id="phone" placeholder="手机号搜索">
                                        </div>
                                    </div>
                                    <div class="layer_div">
                                        <div class="layer_tit">
                                            省份：
                                        </div>
                                        <div class="layer_control">
                                            <select name="province_id" id="province_id" class="w180" lay-filter="province" onclick="getProvinceList();">
                                                <option value="">请选择省份</option>
                                                <?php foreach($provinceList as $key=>$value):?>
                                                <option value="<?php echo $value['region_id'];?>"><?php echo $value['region_name'];?></option>
                                                <?php endforeach;?>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layer_div">
                                        <div class="layer_tit">
                                            城市：
                                        </div>
                                        <div class="layer_control">
                                            <select name="city_id" id="city_id" class="w180" lay-filter="city_id">
                                                <option value="">请选择城市</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layer_div">
                                        <div class="layer_tit">
                                            开始时间：
                                        </div>
                                        <div class="layer_control">
                                            <input type="text" class="w180" id="start" placeholder="开始时间（注册）">
                                        </div>
                                    </div>
                                    <div class="layer_div">
                                        <div class="layer_tit">
                                            结束时间：
                                        </div>
                                        <div class="layer_control">
                                            <input type="text" class="w180" id="end" placeholder="结束时间（注册）">
                                        </div>
                                    </div>
                                    <div class="layer_div">
                                        <div class="layer_tit">
                                            类型：
                                        </div>
                                        <div class="layer_control">
                                            <select id="user_status" class="w180">
                                                <option value="1">一级推荐</option>
                                                <option value="2">二级推荐</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="button_search">
                                    <button class="layui-btn" data-type="search">搜索</button>
                                </div>
                            </div>
                            <table class="layui-table" lay-data="{width:'auto', height:'auto', url:'{:url('Member/memberExtestionList')}',page: true, limit: 10,where:{user_status:1,uid:{$userInfo['uid']}},id:'money4'}" lay-filter="money4">
                                <thead>
                                    <tr>
                                        <th lay-data="{field:'uid', width:80, fixed: true, align:'center'}">UID</th>
                                        <th lay-data="{field:'province_name', width:80, fixed: true, align:'center'}">省份</th>
                                        <th lay-data="{field:'city_name', width:120, align:'center'}">城市</th>
                                        <th lay-data="{field:'user_phone', width:220, align:'center'}">手机号</th>
                                        <th lay-data="{field:'levelName', width:150, align:'center'}">会员等级</th>
                                        <th lay-data="{field:'is_fr_name', width:150, align:'center'}">是否车主（顺）</th>
                                        <th lay-data="{field:'ordersnNum', width:180, align:'center'}">订单数</th>
                                        <th lay-data="{field:'orderMoney', width:180, align:'center'}">订单总额</th>
                                        <th lay-data="{field:'register_time', width:180, align:'center'}">注册时间</th>
                                    </tr>
                                </thead>
                            </table>
                        </div>
                        <div class="layui-tab-item">
                            <table class="layui-table" lay-data="{width:'auto', height:'auto', url:'{:url('Member/memberCommissionList')}',page: true, limit: 10,where:{uid:{$userInfo['uid']}},id:'money5'}" lay-filter="money5">
                                <thead>
                                <tr>
                                    <th lay-data="{field:'id', width:80, fixed: true, align:'center'}">ID</th>
                                    <th lay-data="{field:'typeName', width:100, fixed: true, align:'center'}">类型</th>
                                    <th lay-data="{field:'orderTypeName', width:120, align:'center'}">订单类型</th>
                                    <th lay-data="{field:'order_sn', width:220, align:'center'}">订单号</th>
                                    <th lay-data="{field:'order_money', width:150, align:'center'}">订单金额</th>
                                    <th lay-data="{field:'ratio', width:150, align:'center'}">比例</th>
                                    <th lay-data="{field:'money', width:150, align:'center'}">金额</th>
                                    <th lay-data="{field:'add_time', width:150, align:'center'}">时间</th>
                                </tr>
                                </thead>
                            </table>
                        </div>
                        <div class="layui-tab-item">
                            <div class="layer_content">
                                <div class="layer_form">
                                    <div class="layer_div">
                                        <div class="layer_tit">
                                            活动名称：
                                        </div>
                                        <div class="layer_control">
                                            <input type="text" name="activity_name" lay-verify="required|name" required placeholder="活动名称" class="w180" id="activity_name">
                                        </div>
                                    </div>
                                    <div class="layer_div">
                                        <div class="layer_tit">
                                            活动类型：
                                        </div>
                                        <div class="layer_control">
                                            <select id="activity_model" name="activity_model" class="w180" style="width: 150px;">
                                                <option value="">活动类型</option>
                                                <?php foreach($acitivetyTypeList as $key=>$value):?>
                                                <option value="<?php echo $key;?>"><?php echo $value;?></option>
                                                <?php endforeach;?>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layer_div">
                                        <div class="layer_tit">
                                            开始时间：
                                        </div>
                                        <div class="layer_control">
                                            <input type="text" class="w180" name="activityStartTime" id="activityStartTime" placeholder="到账时间（注册）">
                                        </div>
                                    </div>
                                    <div class="layer_div">
                                        <div class="layer_tit">
                                            结束时间：
                                        </div>
                                        <div class="layer_control">
                                            <input type="text" class="w180" name="activityEndTime" id="activityEndTime" placeholder="到账时间（注册）">
                                        </div>
                                    </div>
                                    <div class="button_search">
                                        <button class="layui-btn" data-type="activity_search" style="margin-right: 50px;float: right">搜索</button>
                                    </div>
                                </div>
                            </div>
                            <table class="layui-table" lay-data="{width:'auto', height:'auto', url:'{:url('AdminActivity/rewardList')}',page: true, limit: 10,where:{uid:{$userInfo['uid']}},id:'money6'}" lay-filter="money6">
                                <thead>
                                <tr>
                                    <th lay-data="{field:'ID', width:100, fixed: true, align:'center'}">ID</th>
                                    <th lay-data="{field:'xm_admin_activity_id', width:150, fixed: true, align:'center'}">活动ID</th>
                                    <th lay-data="{field:'activity_name', width:300, align:'center'}">活动名称</th>
                                    <th lay-data="{field:'amount', width:200, align:'center'}">奖励金额</th>
                                    <th lay-data="{field:'modelName', width:200, align:'center'}">活动类型</th>
                                    <th lay-data="{field:'account_time', width:200, align:'center'}">到账时间</th>
                                    <th lay-data="{field:'order_sn', width:200, align:'center'}">单号</th>
                                    <th lay-data="{field:'typeNmae', width:200, align:'center'}">钱款去向</th>
                                </tr>
                                </thead>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        layui.use(['table','element','layer','laydate'], function () {
            var element = layui.element,layer=layui.layer,table = layui.table,laydate = layui.laydate;
            var $ = layui.jquery;
            layer.photos({
                photos: '.layer-photos-demo'
                ,anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
                ,tab: function(pic, layero){

                }
            });
            laydate.render({
                elem: '#startTime'
                ,type: 'datetime'
                ,theme: '#393D49'
            });
            laydate.render({
                elem: '#endTime'
                ,type: 'datetime'
                ,theme: '#393D49'
            });
            laydate.render({
                elem: '#activityStartTime'
                ,type: 'datetime'
                ,theme: '#393D49'
            });
            laydate.render({
                elem: '#activityEndTime'
                ,type: 'datetime'
                ,theme: '#393D49'
            });
            //充值记录
            table.on('tool(money1)', function (obj) {});
            //消费记录
            table.on('tool(money2)', function (obj) {});
            //退款记录
            table.on('tool(money3)', function (obj) {});
            //推广记录
            table.on('tool(money4)', function (obj) {});
            //佣金明细
            table.on('tool(money5)', function (obj) {});
            //奖励流水
            table.on('tool(money6)', function (obj) {});
            //搜索
            var $ = layui.jquery, active = {
                search: function () {                                               //推广记录搜索
                    var province_id = $.trim($('#province_id').val()),				//省份
                        city_id     = $.trim($('#city_id').val()),
                        phone       = $.trim($("#phone").val()),
                        start_time  = $("#startTime").val(),
                        user_status = $("#user_status").val(),
                        end_time    = $("#endTime").val(),
                        uid         = "{$userInfo['uid']}";
                    table.reload('money4', {
                        url: '/admin/Member/memberExtestionList', where: {
                            "startTime": start_time,
                            "endTime": end_time,
                            "province_id":province_id,
                            "city_id":city_id,
                            "phone":phone,
                            "uid":uid,
                            "user_status":user_status
                        }
                    });
                }
                ,activity_search: function () {
                    var start_time      = $("#activityStartTime").val(),
                        end_time        = $("#activityEndTime").val(),
                        activity_model  = $("#activity_model").val(),
                        activity_name   = $("#activity_name").val(),
                        user_type       = "1",
                        uid             = "{$userInfo['uid']}";
                    table.reload('money6', {
                        url: '/admin/AdminActivity/rewardList', where: {
                            "startTime": start_time,
                            "endTime": end_time,
                            "uid":uid,
                            "user_type":user_type,
                            "activity_name":activity_name,
                            "activity_model":activity_model
                        }
                    });
                }
            };
            $('.layui-btn').on('click', function () {
                var type = $(this).data('type');
                active[type] ? active[type].call(this) : '';
            });
        });
        function getProvinceList(){
            $("#city_id").empty();
            $("#city_id").append('<option value=>请选择城市</option>');
            var province_id = $("#province_id").val();
            $.ajax({
                url:'{:url("/admin/Franchisee/cityList")}',
                async:true,
                type:'post',
                data:{'province_id':province_id},
                success:function(res){
                    $("#city_id").append(res);
                },
                error:function(e){
                    layer.msg('请求错误');return false;
                }
            })
        };

        //更改后台字段
        function upMoney(obj,uid){
            var new_obj = $(obj);
            layer.confirm('确定修改', function(index){
                var money = new_obj.prev('input').val();
                $.post('/admin/User/upMoney',{'wallet_money':money,'uid':uid},function(data){
                    console.log(data)
                    if(data.status == 1){
                        layer.msg(data.msg,{icon: 1});
                    }else{
                        layer.msg(data.msg,{icon: 2});
                    }
                },'json')
                layer.close(index);
            });
        }
    </script>
</block>
